Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Using a kTweenTypePathToMatrixTranslationAndRotation Tween Component

To use a kTweenTypePathToMatrixTranslationAndRotation tween component, do the following:

  1. Create a QT atom container.
  2. Insert a kTweenEntry atom into the QT atom container for the tween.
  3. Insert a kTweenType atom that specifies the tween type into the kTweenEntry atom.
  4. Insert a kTweenData atom into the kTweenEntry atom.
  5. Perform the tweening operation, using QTDoTween .

Listing 16 shows how to create a kTweenTypePathToMatrixTranslationAndRotation tween.

Listing 16 Creating a kTweenTypePathToMatrixTranslationAndRotation tween container

err = CreateSamplePathTweenContainer( container,
                            kTweenTypePathToMatrixTranslationAndRotation,
                            1, false, duration, X2Fix(0.5), &tweenAtom );
if ( err ) goto bail;

err = QTNewTween( &tween, container, tweenAtom, duration );
if ( err ) goto bail;

for ( tweenTime = 0; tweenTime <= duration; tweenTime++ ) {
    MatrixRecord absoluteMatrix;
    
    err = QTDoTween( tween, tweenTime, result, nil, nil, nil );
    if ( err ) goto bail;
    
    absoluteMatrix = *(MatrixRecord *)*result;
}
    
err = QTDisposeTween( tween );

bail:
    if ( container ) QTDisposeAtomContainer( container );
    if ( result ) DisposeHandle( result );

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |